import type { pictureDataList,coordinate } from '@/types/report'

//判断不连续时间轴，在不连续的地方插入null
export const addBreakpoint = (list: pictureDataList, data: coordinate[]) => {
  let newarr: [number, number][] = []
  list.forEach((item) => {
    item.coordinateList.forEach((i) => {
      newarr.push([i.xvalue + 8 * 60 * 60 * 1000, i.yvalue])
    })
  })
  newarr.forEach((item, index) => {
    if (index > 0) {
      if (item[0] - newarr[index - 1][0] > 1000 * 60) {
        //计算相隔多少分钟，并插入多少个null
        const num = Math.floor((item[0] - newarr[index - 1][0]) / (1000 * 60))
        for (let i = 1; i < num; i++) {
          data.push(null)
        }
      }
    }
    data.push(item)
  })
}
